package com.aponteitor.desktop.util;

import java.awt.Component;
import java.awt.Window;

/**
 * @author wellsantos@wellsantos.com
 */
public class ValidationUtil {

    public static void setFocus(Object targetControl){
        if (targetControl instanceof Component){
            ((Component)targetControl).requestFocusInWindow();
            return;
        }
        
        if (targetControl instanceof String){
            for (Window window : Window.getWindows()) {
                Component component = WindowUtil.findComponent((String)targetControl, window);
                if (component != null){
                    // FIXME: testar
                    component.requestFocusInWindow();
                    return;
                }
            }
        }
    }
}
